package com.zyfdroid.mindnote2.utils;

import android.content.Context;
import android.content.SharedPreferences;

public class DocumentEditingPositionManager {


    private static SharedPreferences getSp(Context ctx){
        return ctx.getSharedPreferences("document_positions",Context.MODE_PRIVATE);
    }

    public static int getDocumentPosition(Context ctx, DocumentManager.DocumentInfo dinfo){
        return getSp(ctx).getInt(dinfo.fileName,0);
    }

    public static void setDocumentPosition(Context ctx,DocumentManager.DocumentInfo dinfo,int pos){
        getSp(ctx).edit().putInt(dinfo.fileName,pos).apply();
    }
    public static void removeDocumentPosition(Context ctx,DocumentManager.DocumentInfo dinfo){
        getSp(ctx).edit().remove(dinfo.fileName).apply();
    }



}
